function reallocEventTable(p,nold,n)
  use derived,only:EventTable
  implicit none

  type(EventTable),pointer,dimension(:) :: &
       reallocEventTable,p
  integer,intent(in) :: nold,n

  integer :: i,ierr

  allocate(reallocEventTable(1:n),stat=ierr)
  if (ierr.ne.0) call abnormal_stop("reallocEventTable",&
       "Memory allocation causes an error.")

  if (.not.associated(p)) return

  do i=1,nold
     reallocEventTable(i)%obj1=p(i)%obj1
     reallocEventTable(i)%obj2=p(i)%obj2
     reallocEventTable(i)%obj_seq1=p(i)%obj_seq1
     reallocEventTable(i)%obj_seq2=p(i)%obj_seq2
     reallocEventTable(i)%sqnc=p(i)%sqnc
     reallocEventTable(i)%react_index=p(i)%react_index
     reallocEventTable(i)%event_type=p(i)%event_type
     reallocEventTable(i)%is_spontaneous=&
          p(i)%is_spontaneous
     reallocEventTable(i)%profile_table_index=&
          p(i)%profile_table_index
     reallocEventTable(i)%profile_table_seq=&
          p(i)%profile_table_seq
     reallocEventTable(i)%spont_table_index=&
          p(i)%spont_table_index
     reallocEventTable(i)%removed=p(i)%removed
  end do

  deallocate(p)

  return

end function reallocEventTable
